#include "main.h"
sbit DJ=P1^0;
unsigned char Counter=0;
unsigned char Compare=0;
void main()
{
    unsigned char Key=0;
    unsigned char i=0;
    Timer1Init();
    Compare=10;
    while(1)
    {
        LED_put(1,i);
        Key=key();
        if(Key)
        {
            if(Key==1)
            {
                i++;
                i=i%4;
            }
        }
        if(i==0)
        {
            Compare=0;
        }
        if(i==1)
        {
            Compare=25;
        }
        if(i==2)
        {
            Compare=50;
        }
        if(i==3)
        {
            Compare=100;
        }
    }
}


void Timer_Cut() interrupt 3
{
	TL1 = 0x91;		//设置定时初值
	TH1 = 0xFF;		//设置定时初值
    Counter++;
    Counter = Counter%100;
    if(Counter<Compare)
    {
        DJ=1;
    }
	else{
        DJ=0;
    }
	
}